package com.sepexam.trainsys.service;

import com.sepexam.trainsys.dao.TrainDao;
import com.sepexam.trainsys.entity.TrainInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional
public class TrainService {

    @Autowired
    private TrainDao trainDao;

    //查询所有车次信息，并返回一个结果集
    public List<TrainInfo> getAllTrain() {
        return trainDao.getAllTrain();
    }

    //删除车次信息
    public boolean delTrain(String[] trainId) {
        return trainDao.delTrain(trainId) > 0;
    }

    //查询指定车次的车次信息
    public TrainInfo findTrain(String no) {
        return trainDao.findTrain(no);
    }

}
